package com.xcoder.leetcode;

import java.util.HashSet;
import java.util.Set;

/**
 * https://leetcode-cn.com/problems/distribute-candies/
 */
public class _575_分糖果 {

    public int distributeCandies(int[] candies) {
        if (candies == null) {
            return 0;
        }
        Set<Integer> sisCandies = new HashSet<>();
        for (int c : candies) {
            sisCandies.add(c);
        }
        return Math.min(sisCandies.size(), candies.length >> 1);
    }
}
